/*
 * Created by SharpDevelop.
 * User: MyWife
 * Date: 12/14/2009
 * Time: 10:46 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using popLib;

namespace FileTransferSocket
{
	/// <summary>
	/// Description of Config.
	/// </summary>
	public class Config
	{	
		private static Config _config;
		public static string file_config  = FileLib.getFullPath("Config.ini");
		
		public static Config Singleton(){
			if( _config == null )
				_config = new Config(file_config);
			return _config;
		}
		
		private static Profile config;
		public Config(string file_config){
			config = ProfileLib.initProfile( ProfileLib.ProfileType.Ini, file_config );
			reload();
		}
		
		public void reload(){
			_ServerPort		= config.getValue( "Settings", "ServerPort", "9889" );
			_ClientIP		= config.getValue( "Settings", "ClientIP", "192.168.1.6" );
			_SavePath		= config.getValue( "Settings", "SavePath", "" );
		}
		
		public void saveData(){
			config.setValue( "Settings", "ServerPort", _ServerPort );
			config.getValue( "Settings", "ClientIP", _ClientIP );
			config.getValue( "Settings", "SavePath", _SavePath );
		}
		
		
		
		private string _ServerPort;
		public string ServerPort{ get{return _ServerPort;} set{_ServerPort = value;} }

		private string _ClientIP;
		public string ClientIP{ get{return _ClientIP;} set{_ClientIP = value;} }

		private string _SavePath;
		public string SavePath{ get{return _SavePath;} set{_SavePath = value;} }
	}
}
